import cv2
image=cv2.imread('sobel.png',cv2.IMREAD_GRAYSCALE)

Sobelx=cv2.Sobel(image,cv2.CV_64F,1,0)
Sobely=cv2.Sobel(image,cv2.CV_64F,0,1)

grad_x=cv2.convertScaleAbs(Sobelx)
grad_y=cv2.convertScaleAbs(Sobely)
Sobelxy=cv2.addWeighted(grad_x,0.5,grad_y,0.5,0)

cv2.imshow("Input",image)
cv2.imshow("Sobel_x",Sobelx)
cv2.imshow("ScalrAbs_x",grad_x)
cv2.imshow("Sobel_y",Sobely)
cv2.imshow("ScalrAbs_y",grad_y)
cv2.imshow("",Sobelxy)
cv2.waitKey()
cv2.destroyWindow()